
		<h1 class='med'>Demo <img src='/images/exclaim_med_up.png' /></h1>

	<p>The break button calls a function that contains an error.  The error is wrapped in a try...catch block, 
	which calls the DamnIT function to prompt the user and send an error notification.</p>
	
	<%if !logged_in?%>
	<div style='float:right;width:60%;'>
		<h2>Next Steps</h2>
		<ol style='line-height:25px;'>
			<li><a href='/'>Sign up</a></li>
			<li>Click the link in the confirmation email</li>
			<li>Follow the setup instructions provided</li>
	<%else%>
	<div style='float:right;width:65%;'>
		<h2>Next Steps</h2>
		<ol style='line-height:25px;'>
			<li><img class='icon download' src='/images/documentation/download.png' /><a href='http://javascriptmvc.googlecode.com/files/damnit_demo.html'>Download the demo code</a></li>
			<li>Add your application key to the script tag, as shown in the <a href='/home/setup_instructions'>setup instructions</a></li>
			<li>Load the demo web page</li>
	<%end%>
		</ol>
	</div>
	<div>
	<p><a href='javascript:void(0);' onclick='breakme3()' class='break'></a></p>
	
	<%if !logged_in?%>
	<p><img class='icon download' src='/images/documentation/download.png' /><a href='http://javascriptmvc.googlecode.com/files/damnit_demo.html'>Download the demo</a></p>
	<%end%>
	</div>
	<div class='clear'></div>
	<h2>What to expect</h2>
	
	<ol>
		<li>A box appears prompting you to describe your most recent actions:
		<img src="/images/notification.png"/></li>
		<li>One of the following occurs:
			<ul>
				<li>you type something and click send</li>
				<li>you click "close"</li>
				<li>10 seconds pass with you doing nothing</li>
			</ul>
		</li>
		<li>DamnIT emails <% if logged_in? %>you<%else%>the developer<%end%> the following information:
			<ul>
				<li>Browser</li>
				<li>Page</li>
				<li>HTML Content</li>
				<li>Description (if you entered one)</li>
				<li>Error message</li>
				<li>File name, line number, and stack (if the browser supports them)</li>
			</ul>
			<img src="/images/documentation/email_damnit2.png"/>
			
		</li>
		
	</ol>
	
	<h2>How it works</h2>
	
	<p>When the giant button above is clicked, it calls breakme.  Here is the HTML:</p>
	
	<div class='code_caption'>
	<pre><code>&lt;<span class='html_key'>a</span> href=<span class='string'>'#'</span> onclick=<span class='string'>'breakme()'</span>&gt;&lt;<span class='html_key'>div</span> class=<span class='string'>'break'</span>&gt;&lt;/<span class='html_key'>div</span>&gt;&lt;/<span class='html_key'>a</span>&gt;</code></pre>
	<div class='caption'>Error button HTML</div>
	</div>
	
	<p>Breakme is a function containing an error.  We catch the error and invoke DamnIT's 
	error notification functionality using a call to ApplicationError.notify:</p>
	
	<div class='code_caption'>
	<pre><code><span class='comment'>// the onclick event handler for the link we clicked</span>
<span class='key'>var</span> breakme = <span class='key'>function</span>(){ 
    <span class='comment'>// surrounding your event handler code with try...catch ensures DamnIT 
    // notifies you of errors in all browsers</span>
    <span class='key'>try</span> { 
        <span class='comment'>// this function doesn't exist, so it will cause an error</span>
        a.func.that.will.brea.k(); 
    } <span class='key'>catch</span>(e) { <span class='comment'>// the catch code runs when an error occurs in the try code</span>
        ApplicationError.notify(e); <span class='comment'>// invokes DamnIT's functionality</span>
    }
}</code></pre>
	<div class='caption'>onclick event handler with an error</div>
	</div>
	


<% if logged_in? %>
	<script type='text/javascript' src='https://damnit.jupiterit.com/damnit.js?<%=current_user.crypted_key%>'></script>
<%else%>
	<script type='text/javascript' src='https://damnit.jupiterit.com/damnit.js'></script>
<% end %>

	<script type='text/javascript' src='/javascripts/demo.js'></script>
	
<% if !logged_in? %>
	<script type='text/javascript' src='/javascripts/demo_not_signed_in.js'></script>
<% end %>

	<script type='text/javascript' src='/home/convert'></script>



